Page({
    data: {
        category: [
            {name:'原味',id:'guowei'},
            {name:'经典',id:'shucai'},
            {name:'特制',id:'chaohuo'},
            {name:'卤肉',id:'dianxin'},
            {name:'早餐',id:'cucha'},
            {name:'饭后',id:'danfan'}
        ],
        detail: [
          {
            "id": "guowei",
            "banner": "/image/c1.png",
            "cate": "原味",
            "detail": [
              {
                "thumb": "/image/c2.png",
                "name": "原味经典"
              },
              {
                "thumb": "/image/c3.png",
                "name": "原味麻辣"
              },
              {
                "thumb": "/image/c4.png",
                "name": "原味清汤"
              },
              {
                "thumb": "/image/c4.png",
                "name": "原味秘制"
              },
              {
                "thumb": "/image/c3.png",
                "name": "原味麻辣"
              },
              {
                "thumb": "/image/c2.png",
                "name": "原味经典"
              }
            ]
          },
          {
            "id": "shucai",
            "banner": "/image/c1.png",
            "cate": "经典",
            "detail": [
              {
                "thumb": "/image/s4.png",
                "name": "经典盖饭"
              },
              {
                "thumb": "/image/s5.png",
                "name": "经典炒饭"
              },
              {
                "thumb": "/image/s6.png",
                "name": "经典原味"
              },
              {
                "thumb": "/image/s6.png",
                "name": "经典原味"
              },
              {
                "thumb": "/image/s5.png",
                "name": "经典炒饭"
              },
              {
                "thumb": "/image/s4.png",
                "name": "经典盖饭"
              }
            ]
          },
          {
            "id": "chaohuo",
            "banner": "/image/c1.png",
            "cate": "特制",
            "detail": [
              {
                "thumb": "/image/c2.png",
                "name": "特制盖饭"
              },
              {
                "thumb": "/image/c3.png",
                "name": "特制原味"
              },
              {
                "thumb": "/image/c4.png",
                "name": "特制炒饭"
              },
              {
                "thumb": "/image/c4.png",
                "name": "特制炒饭"
              },
              {
                "thumb": "/image/c3.png",
                "name": "特制原味"
              },
              {
                "thumb": "/image/c2.png",
                "name": "特制盖饭"
              }
            ]
          },
          {
            "id": "dianxin",
            "banner": "/image/c1.png",
            "cate": "卤肉",
            "detail": [
              {
                "thumb": "/image/s4.png",
                "name": "卤肉盖饭"
              },
              {
                "thumb": "/image/s5.png",
                "name": "卤肉盖饭"
              },
              {
                "thumb": "/image/s6.png",
                "name": "卤肉盖饭"
              },
              {
                "thumb": "/image/s6.png",
                "name": "卤肉盖饭"
              },
              {
                "thumb": "/image/s5.png",
                "name": "卤肉盖饭"
              },
              {
                "thumb": "/image/s4.png",
                "name": "卤肉盖饭"
              }
            ]
          },
          {
            "id": "cucha",
            "banner": "/image/c1.png",
            "cate": "早餐",
            "detail": [
              {
                "thumb": "/image/c2.png",
                "name": "早餐酸奶"
              },
              {
                "thumb": "/image/c3.png",
                "name": "早餐酸奶"
              },
              {
                "thumb": "/image/c4.png",
                "name": "早餐酸奶"
              },
              {
                "thumb": "/image/c4.png",
                "name": "早餐酸奶"
              },
              {
                "thumb": "/image/c3.png",
                "name": "早餐酸奶"
              },
              {
                "thumb": "/image/c2.png",
                "name": "早餐酸奶"
              }
            ]
          },
          {
            "id": "danfan",
            "banner": "/image/c1.png",
            "cate": "饭后",
            "detail": [
              {
                "thumb": "/image/s4.png",
                "name": "饭后一支烟"
              },
              {
                "thumb": "/image/s5.png",
                "name": "赛过活神仙"
              },
              {
                "thumb": "/image/s6.png",
                "name": "槟榔加烟"
              },
              {
                "thumb": "/image/s6.png",
                "name": "法力无边"
              },
              {
                "thumb": "/image/s5.png",
                "name": "火中取栗"
              },
              {
                "thumb": "/image/s4.png",
                "name": "探囊取物"
              }
            ]
          }
        ],
        curIndex: 0,
        isScroll: false,
        toView: 'guowei'
    },
    onReady(){
        // var self = this;
        // wx.request({
        //     url:'./xxx.json',
        //     dataType:"json",
        //     success(res){
        //         self.setData({
        //             detail : res.data
        //         })
        //     }
        // });
        
    },
    switchTab(e){
      const self = this;
      this.setData({
        isScroll: true
      })
      setTimeout(function(){
        self.setData({
          toView: e.target.dataset.id,
          curIndex: e.target.dataset.index
        })
      },0)
      setTimeout(function () {
        self.setData({
          isScroll: false
        })
      },1)
        
    }
    
})